import store from "@/store";
import { dateFormat } from "@/util/date";

export default {
  filters: {
    reviewSelectValue(val, opt) {
      if (!opt.length) {
        return val;
      }
      for (let i = 0; i < opt.length; i++) {
        if (opt[i].value === val) {
          return opt[i].label;
        }
      }
    },
    formatDate(val) {
      return dateFormat(val, "yyyy-MM-dd hh:mm:ss");
    },
  },
  beforeRouteLeave(a, b, c) {
    store.commit("table/SET_ROUTER_FORM", true);
    c();
  },
};
